<script>
    import { Uploader } from './storage.js';
    import { Minio } from './minio.js';
    import { Alibaba } from './alibaba.js';
  
    let file;
    let uploader = new Uploader(new Alibaba());
  
    function handleFileUpload() {
      if (file) {
        uploader.upload(file);
      }
    }
  
    function switchToMinio() {
      uploader.setStrategy(new Minio());
    }
    function switchToAlibaba() {
      uploader.setStrategy(new Alibaba());
    }
  </script>
  
  <input type="file" bind:this={file} />
  <button on:click={handleFileUpload}>Upload</button>
  <button on:click={switchToMinio}>Switch to MinIO</button>
  <button on:click={switchToAlibaba}>Switch to Alibaba</button>
  